home *** CD-ROM | disk | FTP | other *** search
- diff -u ../qmail-1.01-unmodified/qmail-remote.c ./qmail-remote.c
- --- ../qmail-1.01-unmodified/qmail-remote.c Tue Apr 15 07:05:23 1997
- +++ ./qmail-remote.c Thu Oct 2 10:14:29 1997
- @@ -41,6 +41,8 @@
- stralloc helohost = {0};
- stralloc routes = {0};
- struct constmap maproutes;
- +stralloc routesip = {0};
- +struct constmap maproutesip;
- stralloc host = {0};
- stralloc sender = {0};
-
- @@ -114,6 +116,16 @@
- case 1:
- if (!constmap_init(&maproutes,routes.s,routes.len,1)) temp_nomem(); break;
- }
- +
- + switch(control_readfile(&routesip,"control/smtproutesip",0))
- + {
- + case -1:
- + if (errno == error_nomem) temp_nomem(); temp_control();
- + case 0:
- + if (!constmap_init(&maproutesip,"",0,1)) temp_nomem(); break;
- + case 1:
- + if (!constmap_init(&maproutesip,routesip.s,routesip.len,1)) temp_nomem(); break;
- + }
- }
-
- char smtptobuf[1024];
- @@ -461,12 +473,53 @@
- {
- int s;
-
- + /* Map IP numbers according to control/smtproutesip. */
- + unsigned int j;
- + int len;
- + char hostip[16]; /* Enough to hold xxx.xxx.xxx.xxx */
- + ipalloc ip2 = {0};
- + stralloc host2 = {0};
- + char *relayhost2 = 0;
- + unsigned long connport = port, port2 = port;
- +
- + hostip[len = ip_fmt (hostip,&ip.ix[i].ip)] = '\0';
- +
- + for (j = len; (signed int) j > -1; j --)
- + if ((j == len) || (j == 0) || (hostip[j - 1] == '.'))
- + if ((relayhost2 = constmap (&maproutesip, hostip, j)))
- + break;
- + if (relayhost2 && !*relayhost2) relayhost2 = 0;
- +
- + if (relayhost2)
- + {
- + j = str_chr(relayhost2,':');
- + if (relayhost2[j])
- + {
- + scan_ulong(relayhost2 + j + 1,&port2);
- + relayhost2[j] = 0;
- + }
- + if (!stralloc_copys(&host2,relayhost2)) temp_nomem();
- +
- + switch (dns_ip (&ip2, &host2))
- + {
- + case DNS_HARD: break;
- + case DNS_SOFT: temp_dns ();
- + case DNS_MEM: temp_nomem ();
- + case 1:
- + if (ip2.len <= 0) temp_dns();
- + }
- +
- + ip.ix[i].ip = ip2.ix[0].ip;
- + connport = port2;
- + if (!stralloc_copy(&host,&host2)) temp_nomem ();
- + }
- +
- if (tcpto(&ip.ix[i].ip)) continue;
-
- s = socket(AF_INET,SOCK_STREAM,0);
- if (s == -1) temp_oserr();
-
- - if (timeoutconn(s,&ip.ix[i].ip,(unsigned int) port,timeoutconnect) == 0)
- + if (timeoutconn(s,&ip.ix[i].ip, connport,timeoutconnect) == 0)
- {
- tcpto_err(&ip.ix[i].ip,0);
- partner = ip.ix[i].ip;
-